package com.example.javabasic.suanfa.剑指offer.跳台阶2;

/**
 * @description 跳台阶2  一次可以条1-n阶  有x阶   共有多少种跳法
 * @Author Lin FuYuan
 * @date 2021/7/8
 */
public class Solution {

    /**
     * 跳台阶2
     * @author Lin FuYuan
     * @param target
     * @date 2021/7/8
     * @return int
     */
    public int jumpFloorII(int target) {
        // target = 1   返回1
        //target = 2 返回2
        //target =3 返回 4;
        //target = 4 返回 8
        //得出  fn = 2f(n-1)
        int f = 1;
        for (int i = 2; i <= target; i++) {
            f = f<<1;
        }
        return f;
    }

}
